//
//  CustomAlertViewController.swift
//  Eternity
//
//  Created by cll12_12 on 2016/12/14.
//  Copyright © 2016年 ZhengWei. All rights reserved.
//

import UIKit

class CustomAlertViewController: UIAlertController {

    // MARK: - life cycle
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
    
    // MARK: - private method
    func showActionSheet(controller: UIViewController, destructiveTitle: String, cancelTitle: String) {
        
        let readAction = UIAlertAction(title: destructiveTitle, style: .destructive, handler: {(_) in
            print("已读")
        })
        
        let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel, handler: {(_) in
            print("取消")
        })
        
        self.addAction(readAction)
        self.addAction(cancelAction)
        
        controller.present(self, animated: true, completion: nil)
    }
    
    func showAlerView(controller: UIViewController, cancelTitle: String, okTitle: String, textStr: String) {
        let okAction = UIAlertAction(title: okTitle, style: .default, handler: {(_) in
            print("确定")
        })
        
        let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel, handler: {(_) in
            print("取消")
        })
        
        let textField = UITextField(frame: CGRect(x: 0, y: 0, width: 237, height: 32))
        textField.placeholder = textStr
        textField.leftViewMode = .always
        textField.leftView = UIView(frame: CGRect(x: 0, y: 0, width: 5, height: 32))
        
        self.addAction(okAction)
        self.addAction(cancelAction)
        self.addTextField { (textField) in
            print("框框")
        }
        
        controller.present(self, animated: true, completion: nil)
    }
    
    

}
